﻿using System;
using System.Web.Mvc;
using TeamsPortal.ServiceClient;
using TeamsPortal.Web.Controllers.Helpers;

namespace TeamsPortal.Web.Controllers
{
	public class HomeController : BaseController
	{
        public ActionResult Index()
		{
            ViewBag.Template = Template;
            return View();
		}

		public ActionResult About()
		{
            return Static("AboutTheTeam", true);
		}

        public ActionResult AboutHardball()
        {
            return Static("AboutHardball", true);
        }

		/// <summary>
		/// This action throws an exception. Use this action to test the logging
		/// </summary>
		public ActionResult Error()
		{
			if (this.User != null && this.User.Role == UserRole.Admin)
			{
				throw new Exception("This is a dummy exception thrown by the Portal application.");
			}
			return ResultHelper.NotFoundResult(this);
		}

		/// <summary>
		/// This action is used when another action was not found.
		/// </summary>
		/// <returns></returns>
		public ActionResult NotFound()
		{
			return ResultHelper.NotFoundResult(this);
		}
	}
}
